export const paramType = (arg: any) => Object.prototype.toString.call(arg).slice(8, -1).toLowerCase();

export const timeout = (callback: any, time: number | string) => {
    time = Number(time) || 100;
    callback = paramType(callback) === 'function' ? callback : null;
    if (callback) {
        let newTimeout: number | undefined;
        newTimeout = window.setTimeout(function () {
            callback();
            window.clearTimeout(newTimeout);
            newTimeout = undefined;
            time = 0;
            callback = null;
        }, time)
    }
};
